package mall.pojo;
// default package
// Generated 02-Nov-2013 21:11:38 by Hibernate Tools 3.4.0.CR1

import static javax.persistence.GenerationType.IDENTITY;

import java.util.Date;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Transient;

import org.springframework.web.multipart.commons.CommonsMultipartFile;

/**
 * Shop generated by hbm2java
 */
@Entity
@Table(name = "shop", catalog = "mall")
public class Shop implements java.io.Serializable {

	private Integer id;
	private Industry industry;
	private Member member;
	private String address;
	private String description;
	private String name;
	private String phone;
	private CommonsMultipartFile file;
	private String picture;
	private Date date;
	private int state;  // 1 : open , 2 :closed
	private Integer templateId;
	private Set<Product> products = new HashSet<Product>(0);
	private Set<Orders> orderses = new HashSet<Orders>(0);
	private Set<Category> categories = new HashSet<Category>(0);
	private String paymentUsername;
	private String paymentPassword;
	//private Set<Category> categories_1 = new HashSet<Category>(0);

	public Shop() {
	}

	public Shop(Industry industry, Member member, String address,
			String description, String name, String phone, String picture,
			Date date, int state,String paymentUsername,String paymentPassword) {
		this.industry = industry;
		this.member = member;
		this.address = address;
		this.description = description;
		this.name = name;
		this.phone = phone;
		this.picture = picture;
		this.date = date;
		this.state = state;
		this.paymentUsername=paymentUsername;
		this.paymentPassword=paymentPassword;
	}

	public Shop(Industry industry, Member member, String address,
			String description, String name, String phone, String picture,
			Date date, int state, Integer templateId, Set<Product> products,
			Set<Orders> orderses, Set<Category> categories,String paymentUsername,String paymentPassword
			) {
		this.industry = industry;
		this.member = member;
		this.address = address;
		this.description = description;
		this.name = name;
		this.phone = phone;
		this.picture = picture;
		this.date = date;
		this.state = state;
		this.templateId = templateId;
		this.products = products;
		this.orderses = orderses;
		this.categories = categories;
		this.paymentUsername=paymentUsername;
		this.paymentPassword=paymentPassword;
		//this.categories_1 = categories_1;
	}

	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "id", unique = true, nullable = false)
	public Integer getId() {
		return this.id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "industry_id", nullable = false)
	public Industry getIndustry() {
		return this.industry;
	}

	public void setIndustry(Industry industry) {
		this.industry = industry;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "member_id", nullable = false)
	public Member getMember() {
		return this.member;
	}

	public void setMember(Member member) {
		this.member = member;
	}

	@Column(name = "address", nullable = false)
	public String getAddress() {
		return this.address;
	}

	public void setAddress(String address) {
		this.address = address;
	}

	@Column(name = "description", nullable = false)
	public String getDescription() {
		return this.description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	@Column(name = "name", nullable = false, length = 45)
	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Column(name = "phone", nullable = false, length = 45)
	public String getPhone() {
		return this.phone;
	}

	public void setPhone(String phone) {
		this.phone = phone;
	}

	@Column(name = "picture", nullable = false)
	public String getPicture() {
		return this.picture;
	}

	public void setPicture(String picture) {
		this.picture = picture;
	}

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "date", nullable = false, length = 19)
	public Date getDate() {
		return this.date;
	}

	public void setDate(Date date) {
		this.date = date;
	}

	@Column(name = "state", nullable = false)
	public int getState() {
		return this.state;
	}

	public void setState(int state) {
		this.state = state;
	}

	@Column(name = "template_id")
	public Integer getTemplateId() {
		return this.templateId;
	}

	public void setTemplateId(Integer templateId) {
		this.templateId = templateId;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "shop")
	public Set<Product> getProducts() {
		return this.products;
	}

	public void setProducts(Set<Product> products) {
		this.products = products;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "shop")
	public Set<Orders> getOrderses() {
		return this.orderses;
	}

	public void setOrderses(Set<Orders> orderses) {
		this.orderses = orderses;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "shop")
	public Set<Category> getCategories() {
		return this.categories;
	}

	public void setCategories(Set<Category> categories) {
		this.categories = categories;
	}

	/*@OneToMany(fetch = FetchType.LAZY, mappedBy = "shop")
	public Set<Category> getCategories_1() {
		return this.categories_1;
	}

	public void setCategories_1(Set<Category> categories_1) {
		this.categories_1 = categories_1;
	}*/
	@Transient
	public CommonsMultipartFile getFile() {
		return file;
	}
	
	
	public void setFile(CommonsMultipartFile file) {
		this.file = file;
	}

	@Column(name = "payment_username", nullable = false, length = 45)
	public String getPaymentUsername() {
		return this.paymentUsername;
	}

	public void setPaymentUsername(String paymentUsername) {
		this.paymentUsername = paymentUsername;
	}

	@Column(name = "payment_password", nullable = false)
	public String getPaymentPassword() {
		return this.paymentPassword;
	}

	public void setPaymentPassword(String paymentPassword) {
		this.paymentPassword = paymentPassword;
	}
	

}